package com.actionscriptclass.dataholder
{
	import com.actionscriptclass.dataholder.RegisterDataHolder;
	
	public class RegisterData implements IDataHolder
	{
		private var _registerData:Array;
        private var _counter:uint;
        private var _registerDataHolder:RegisterDataHolder;
        private var _mainArray:Array;
        private var _repeat:uint;
       
	    public function RegisterData(delay:uint,repeatParam:uint)
	    {
	    	 _mainArray=new Array();
		     _registerData=new Array();
			 _registerDataHolder=new RegisterDataHolder();
		     _mainArray.push([delay]);	
		     repeat=repeatParam;
		     
		      _counter=0;
	    }
		
		//adding new data 
		public function addData(dataObject:Object):void
		{
			  _registerData.push(dataObject);
			  //setting linkage, linkage will be out in futere version but for now we have to think for flash and flex objects so it is better to have unique way to get linkage.
			  _registerDataHolder.addObject(dataObject['linkage'] ); 
	    }
	 
	    //no need for processing data 
		public function processData():void
	    { 
	       
	    }
		
		public function get repeat():uint
		{
		    return	_repeat;
		}
		
		public function set repeat(num:uint):void
	    {
	  		_repeat=num;
	    }
		//
     	public function get dataHolderData():*
		{
			 return _registerDataHolder 
		}
		
	 
		//filling the data holder for registerData
		private function exec():void
		{   
			  //iteration over 
			  for(var i:uint=0;i<_registerData.length;i++)
			  {		 var tempArray:Array=new Array();
			  		 for(var ie:uint=0;ie<_registerData[i]['arrayLenght'];ie++)
					 {
				         tempArray[ _registerData[i]['array'][ie] ]= _registerData[i]['object'][ _registerData[i]['array'][ie] ];
				     }	
					  _registerDataHolder.addData(_registerData[i]['linkage'], tempArray);
			   }
	
	 	}
	 	
	 	 
		public function getDelay(num:uint):uint
		{
		  return _mainArray[0][0]
		}
		
		public function setDelay(value:uint,position:uint):void
		{
		    _mainArray[position][0]=value;
		}
		 
		public function functionExec(num:uint):void
		{
		  exec()
		}
	}
}